/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project.entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;

@IdClass(project.entity.RevisaoKey.class)

/**
 *
 * @author serafim
 */
@NamedQueries({
    @NamedQuery(name="listaRevisor", query="SELECT r FROM Revisao r WHERE UPPER(r.revisor.username) LIKE UPPER(:username)"),
    @NamedQuery(name="listaSubmissao", query="SELECT r FROM Revisao r WHERE r.submissao.idSubmissao = :idSubmissao AND r.estado = 2"),
    @NamedQuery(name="listaRevisoresSubmissao", query="SELECT r.revisor FROM Revisao r WHERE r.submissao.idSubmissao = :idSubmissao")
})
@Entity
public class Revisao implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @ManyToOne
    private Revisor revisor;
    
    @Id
    @ManyToOne
    private Submissao submissao;
    
    @Column(length = 10240)
    private String critica;
    
    private short classificacao;
    
    @NotNull
    private short estado;

    public Revisao() {
    }

    public Revisao(Revisor revisor, Submissao submissao, String critica, short classificacao, short estado) {
        this.revisor = revisor;
        this.submissao = submissao;
        this.critica = critica;
        this.classificacao = classificacao;
        this.estado = estado;
    }
    
    /**
     * @return the critica
     */
    public String getCritica() {
        return critica;
    }

    /**
     * @param critica the critica to set
     */
    public void setCritica(String critica) {
        this.critica = critica;
    }

    /**
     * @return the classificacao
     */
    public short getClassificacao() {
        return classificacao;
    }

    /**
     * @param classificacao the classificacao to set
     */
    public void setClassificacao(short classificacao) {
        this.classificacao = classificacao;
    }

    /**
     * @return the estado
     */
    public short getEstado() {
        return estado;
    }

    /**
     * @param estado the estado to set
     */
    public void setEstado(short estado) {
        this.estado = estado;
    }

    /**
     * @return the revisor
     */
    public Revisor getRevisor() {
        return revisor;
    }

    /**
     * @param revisor the revisor to set
     */
    public void setRevisor(Revisor revisor) {
        this.revisor = revisor;
    }

    /**
     * @return the submissao
     */
    public Submissao getSubmissao() {
        return submissao;
    }

    /**
     * @param submissao the submissao to set
     */
    public void setSubmissao(Submissao submissao) {
        this.submissao = submissao;
    }
}
